package com.wpw.dream.shejimoshi;

public class QuestionModel {
	
	public void method1(String a, String b) {
		System.out.println("这里调用前一样" + a +" and " + b);
		do1(a, b);
		System.out.println("这里调用后一样" + a +" and " + b);
	}

	public void method2(String a, String b) {
		System.out.println("这里调用前一样" + a +" and " + b);
		do2(a, b);
		System.out.println("这里调用后一样" + a +" and " + b);
	}

	
	public void do1(String a, String b) {
		System.out.println("do1"  + a +" and " + b);
	}
	
	public void do2(String a, String b) {
		System.out.println("do2"  + a +" and " + b);
	}
	
	public void method(String a, String b, DoMethod doM) {
		System.out.println("这里调用前一样" + a +" and " + b);
		doM.doM(a,b);
		System.out.println("这里调用后一样" + a +" and " + b);
	}
	
	public interface DoMethod {
		void doM(String a, String b);
	}
	
	public static void main(String[] args) {
		QuestionModel q = new QuestionModel();
		q.method("a", "B", new DoMethod() {
			
			@Override
			public void doM(String a, String b) {
				System.out.println("do1"  + a +" and " + b);
				
			}
		});
		q.method("a", "B", new DoMethod() {
			
			@Override
			public void doM(String a, String b) {
				System.out.println("do2"  + a +" and " + b);
				
			}
		});
	}
}
